package com.infonam.data.source.model;



import java.util.Date;
import java.util.LinkedList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@Entity
@Table(name="store",catalog="sakila")
public class Store {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="store_id",unique=true,nullable=false)
	private int store_id;
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="manager_staff_id",nullable=false)
	private Staff manager_staff_id;
	@ManyToOne(fetch=FetchType.LAZY)
	@Cascade({CascadeType.SAVE_UPDATE})
	@JoinColumn(name="address_id",nullable=false)
	private Address address_id;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="last_update",nullable=false,columnDefinition="TIMESTAMP default CURRENT_TIMESTAMP on update TIMESTAMP")
	private Date last_update;
	@OneToMany(fetch=FetchType.LAZY,mappedBy="store")
	@Cascade({CascadeType.ALL})
	private List<Staff> staffList = new LinkedList<Staff>();
	@OneToMany(fetch=FetchType.LAZY,mappedBy="store")
	@Cascade({CascadeType.ALL})
	private List<Customer> customerList = new LinkedList<Customer>();
	@OneToMany(fetch=FetchType.LAZY,mappedBy="store")
	@Cascade({CascadeType.ALL})
	private List<Inventory> inventories = new LinkedList<Inventory>();
	public int getStore_id() {
		return store_id;
	}
	public void setStore_id(int store_id) {
		this.store_id = store_id;
	}
	public Staff getManager_staff_id() {
		return manager_staff_id;
	}
	public void setManager_staff_id(Staff manager_staff_id) {
		this.manager_staff_id = manager_staff_id;
	}
	public Address getAddress_id() {
		return address_id;
	}
	public void setAddress_id(Address address_id) {
		this.address_id = address_id;
	}
	public Date getLast_update() {
		return last_update;
	}
	public void setLast_update(Date last_update) {
		this.last_update = last_update;
	}
	public List<Staff> getStaffList() {
		return staffList;
	}
	public void setStaffList(List<Staff> staffList) {
		this.staffList = staffList;
	}
	public List<Customer> getCustomerList() {
		return customerList;
	}
	public void setCustomerList(List<Customer> customerList) {
		this.customerList = customerList;
	}
	public List<Inventory> getInventories() {
		return inventories;
	}
	public void setInventories(List<Inventory> inventories) {
		this.inventories = inventories;
	}
}
